Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Многопоточная обработка #14

Merged
merged 25 commits into from
Jun 28, 2023
Merged

Conversation

StainlessSteelSnake
Copy link
Owner

No description provided.

internal/storage/db.go Outdated Show resolved Hide resolved
internal/storage/storage.go Outdated Show resolved Hide resolved
internal/handlers/handlers.go Outdated Show resolved Hide resolved
internal/handlers/handlers.go Outdated Show resolved Hide resolved
internal/handlers/handlers.go Show resolved Hide resolved
internal/storage/db.go Outdated Show resolved Hide resolved
internal/storage/db.go Outdated Show resolved Hide resolved
internal/storage/db.go Outdated Show resolved Hide resolved
internal/storage/db.go Outdated Show resolved Hide resolved
@@ -164,6 +285,10 @@ func (s *databaseStorage) AddURLs(longURLs batchURLs, user string) (batchURLs, e

func (s *databaseStorage) CloseFunc() func() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

есть ли необходимость в таком усложнении?
может стоит переименовать в Shutdown и явно вызывать при завершении работы сервиса?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это сделано для того, чтобы можно было универсально вернуть функцию в пакет main, вне зависимости от того, работаем мы с файлом или с БД. Проще повесить её на defer в основной программе, чем отслеживать факт завершения работы сервиса какими-либо специальными средствами.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defer storage.Shutdown()
или определить анонимную функции в самом main

в рамках метода Shutdown оставить текущую логику, определенную в реализациях

Copy link

@mr-fard4y mr-fard4y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

return urls
}

func (s *dummyStorage) deletionQueueProcess(ctx context.Context) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

метод с нереализованной логикой

есть ли необходимость?

switch {
case database != "":
dStorage := newDBStorage(ctx, newMemoryStorage(), database)
dStorage.deletionCancel = deletionCancel

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

дублирование кода в ветвлениях

@StainlessSteelSnake StainlessSteelSnake removed the request for review from capsulated February 6, 2023 19:08
@StainlessSteelSnake StainlessSteelSnake merged commit 54ebc24 into main Jun 28, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants